package com.msgqu.share.config;

import io.minio.MinioClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description:
 * @author: wsj
 * @create: 2020-11-25 17:17
 * @throws:
 */
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {

    private String endpoint;
    private int port;
    private String accesskey;
    private String cecretkey;

    @Bean
    public MinioClient minioClient(){
        MinioClient minioClinet = MinioClient.builder()
                .endpoint(endpoint,port,false)
                .credentials(accesskey, cecretkey)
                .build();
        return minioClinet;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getAccesskey() {
        return accesskey;
    }

    public void setAccesskey(String accesskey) {
        this.accesskey = accesskey;
    }

    public String getCecretkey() {
        return cecretkey;
    }

    public void setCecretkey(String cecretkey) {
        this.cecretkey = cecretkey;
    }
}
